import {roleList} from '../../../request/app'
//封装一个state接口
interface roleSate {
    rolelist: Array<object>
}
 const state = {
    rolelist:[]
}

 const getters = {
    getRoleList(state:roleSate){
        return state.rolelist
    }
}

 const mutations = {
    REQ_LIST(state:roleSate,payload:any){
        state.rolelist = payload
    }
}

 const actions = {
    getRoleListAction(context:any){
        roleList()
        .then((res:any)=>{
            console.log(res,'角色列表');
            if(res.code == 200){
                context.commit('REQ_LIST',res.list)
            }
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}